<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/jsphead.jsp" %>
<!doctype html>
<html>
<head>
	<title>${appTitle}</title>
	<link rel="stylesheet" type="text/css" href="css/default.css"/>
	<link rel="stylesheet" type="text/css" href="jslib/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
	<style type="text/css">
		a:hover {color:#00f;}
		a:hover {text-decoration: underline;}
		em {color:red;font-style:normal;}
		#words{
			width:600px;height:22px;padding:4px 7px;padding:6px 7px 2px\9;font:16px arial;
			background:url(image/search-input.png) no-repeat;
			border:1px solid #cdcdcd;border-color:#9a9a9a #cdcdcd #cdcdcd #9a9a9a;
			vertical-align:top;margin-right:5px
		}
		.btn{
			width:95px;height:32px;padding:0;padding-top:2px\9;border:none;font-size:14px;
			background:#ddd url(image/search-input.png) 0 -35px;cursor:pointer
		}
		.btn_h{background-position:-100px -35px}
		.btn_wr{
			width:97px;height:34px;display:inline-block;
			background:url(image/search-input.png) no-repeat -202px bottom;
			padding-top:1px;*position:relative
		}
		.result_item{margin-bottom:15px;}
		.result_item:hover {background-color:#eee;}
		.result_item_hover {background-color:#eee;}
		
		.book_type{color:#666;margin-left:8px;font-size:14px;font-family:仿宋;}
		
		.page {border:1px solid #aaa;padding:2px 4px;}
		.page:hover{background-color:#eee; color:#00f;}
	</style>
	<script type="text/javascript" src="jslib/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="jslib/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript">
		function toPage(pageNo){
			var form = document.forms[0];
			form["page.pageNo"].value = pageNo;
			form.submit();
		}
		
		$(function(){
			markWords();
			resultHoverIE6();
			$(".book").fancybox({
				'width'				: '100%',
				'height'			: '100%',
				'padding'			: 8,
				'margin'			: 20,
				'enableEscapeButton': true,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
		});
		
		function markWords(){
			var result = $("#result");
			var words = $("#words").val().split(" ");
			for (var i = 0; i < words.length; i ++){
				result.html(result.html().replace(new RegExp(words[i],'g'), '<em>' + words[i] + '</em>'));
			}
		}
		
		function resultHoverIE6(){
			if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style){
				$(".result_item").hover(function(){
					$(this).addClass("result_item_hover");
				},function(){
					$(this).removeClass("result_item_hover");
				});
			}
		}
	</script>
</head>
<body style="margin:0px;padding:10px 0 20px 10px;background-image:url(image/bg.png);">
<form action="view!search.action" method="get" onsubmit="if (this.words.value.match(/^\s*$/)!=null) {location.href='${baseHref}';return false;}">
	<input type="hidden" name="page.pageSize" value="15">
	<input type="hidden" name="page.pageNo" value="1">
	<div style="width:900px;">
		<div style="float:left;width:150px;">
			<a href="${baseHref}" alt="首页"><img src="image/ln_title2.gif" style="width:140px;border:none;" alt="首页"/></a>
		</div>
		<div style="float:left;">
			<div>
			<input id="words" name="words" value="<c:out value="${words}"/>">
			<button type="submit" class="btn" onmousedown="this.className='btn btn_h'" 
				onmouseout="this.className='btn'">搜  索</button>
			</div>
			<s:if test="page.totalItems>0">
			<div style="font-size:12px;color:#333;margin-top:5px;">
				找到相关结果&nbsp;<s:property value="page.totalItems"/>&nbsp;条
				<s:if test="page.pageNo > 1">，以下是第<s:property value="page.pageNo"/>页</s:if>
				( 耗时<s:property value="searchTime"/>秒)
			</div>
			</s:if>
		</div>
		<div style="clear:both;"></div>
	</div>
	<div style="width:900px;">
		<div style="float:left;width:150px;line-height:25px;font-size:14px;">
			<ul>
				<li><a class="a1" href="view!bookGuide.action" target="_blank">凡&nbsp;&nbsp;例</a>
				<li><a class="a1" href="view!showCatalogue.action" target="_blank">总目浏览</a>
				<li><a class="a1" href="view!bookPhotos.action" target="_blank">图片库</a>
				<li><a class="a1" href="admin/" target="_blank">书籍管理</a>
			</ul>
		</div>
		<div id="result" style="float:left;margin-top:10px;line-height:22px;width:750px;">
			<s:if test="page.totalItems>0">
			<s:iterator value="page.result"><%-- 结果集 --%>
			<div class="result_item">
				<div style="font-size:16px;">
					<a class="book" href="view!bookDetail.action?bookId=<s:property value="book.id"/>" target="_blank"><s:property value="book.name"/></a>
					<span class="book_type">
						<s:property value="type.name.substring(type.name.indexOf('、')+1)"/>
					</span>
				</div>
				<s:if test="book.name2.length()>0">
					<div style="color:gray;">又名：<s:property value="book.name2"/></div>
				</s:if>
				<div style="color:#336600;">
					<span><s:property value="book.author"/></span>
					<s:if test="book.source.length()>0">
					<span style="margin-left:5px;">见<s:property value="book.source"/></span>
					</s:if>
					<span><s:property value="book.rolls"/></span>
				</div>
				<s:if test="bookDesc.length()>0">
				<div style="margin-top:2px;"><s:property value="bookDesc"/></div>
				</s:if>
			</div>
			</s:iterator>
				<%-- 分页条 --%>
				<s:if test="page.slider.size > 1">
				<div style="background:#e4d7ca; padding:8px;margin-bottom:10px;">第&nbsp;
					<s:iterator value="page.slider">
						<s:if test="page.pageNo==top"><strong><s:property/></strong></s:if>
						<s:else><a class="page" href="javascript:toPage(<s:property/>)"><s:property/></a></s:else>
					</s:iterator>
					&nbsp;页
				</div>
				</s:if>
			</s:if>
			<s:else>
				找不到和您的查询“<font color="red"><s:property value="words"/></font>” 相符的内容或信息。
				<p style="margin-top:1em">建议：
				<ul style="margin:0 0 2em;margin-left:1.3em">
					<li>请检查输入字词有无错误。
					<li>请尝试其他的查询词
					<li>请改用较常见的字词。
					<li>请减少查询字词的数量。
				</ul>
			</s:else>
		</div>
	</div>
</form>
</body>
</html>
